package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import Repositorio.ConexaoDB;
import Repositorio.Rep_Aluno;

import java.awt.Window.Type;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.text.ParseException;

import Repositorio.ConexaoDB;
import javax.swing.JTabbedPane;
import javax.swing.JMenuItem;
import javax.swing.border.TitledBorder;


public class TelaPrincipal extends JFrame 
{

	private JMenuItem itemMenuAluno;
	private JMenuItem itemMenuProfessor;
	private JMenuItem itemMenuDisciplina;
	private JMenu mnCadastros;
	private JMenuBar menuBar;
	private JMenu mnConsultas;
	private JMenuItem itemMenuConsultaAluno;
	private JMenuItem itemMenuConsultasProfessor;
	private JMenuItem itemConsultasDisciplina;
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TelaPrincipal frame = new TelaPrincipal();
					frame.setVisible(true);
					frame.setLocationRelativeTo(null);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
		
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			}
			// TODO Auto-generated catch block
 catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InstantiationException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (UnsupportedLookAndFeelException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			finally
			{
				
			}
			
		
		
	}

	/**
	 * Create the frame.
	 */
	public TelaPrincipal() {
		super("Controle Academico");
		setAlwaysOnTop(true);
		setResizable(false);
		setTitle("Programa de Gerenciamento Academico");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 546, 428);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		panel.setLayout(null);
		contentPane.add(panel, BorderLayout.CENTER);
		
		JButton btnNotas = new JButton("Atribuir Notas");
		btnNotas.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) 
			{
				CadNotasAluno cad = null;
				try {
					cad = new CadNotasAluno();
				} catch (ParseException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				cad.setVisible(true);
			}
		});
		btnNotas.setBounds(20, 111, 100, 33);
		panel.add(btnNotas);
		
		JButton btnSair = new JButton("Sair");
		
		btnSair.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				//String aviso = null;
				
			}
		});
		btnSair.setBounds(440, 346, 80, 33);
		panel.add(btnSair);
		
		JPanel panel_1 = new JPanel();
		panel_1.setBorder(new TitledBorder(null, "Cadastro", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel_1.setBounds(10, 11, 510, 89);
		panel.add(panel_1);
		panel_1.setLayout(null);
		
		JButton btnAluno = new JButton("Aluno");
		btnAluno.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) 
			{
				CadAluno cad_aluno = null;
				try {
					cad_aluno = new CadAluno();
				} catch (ParseException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				cad_aluno.setVisible(true);
			}
		});
		btnAluno.setBounds(10, 28, 100, 50);
		panel_1.add(btnAluno);
		
		JButton btnProfessor = new JButton("Professor");
		btnProfessor.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				CadProfessor cad_prof;
				try {
					cad_prof = new CadProfessor();
					cad_prof.setVisible(true);
				} catch (ParseException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
		btnProfessor.setBounds(199, 28, 100, 50);
		panel_1.add(btnProfessor);
		
		JButton btnDisciplina = new JButton("Disciplina");
		btnDisciplina.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				CadDisciplina cad_disc = new CadDisciplina();
				cad_disc.setVisible(true);
			}
		});
		btnDisciplina.setBounds(388, 28, 100, 50);
		panel_1.add(btnDisciplina);
		
		itemMenuAluno = new JMenuItem("Cadastro");
		//panel.add(menuBar);
	}
}
